torndb 是Facebook开源出来的Python Mysqldb的封装包,tornado 3.0后采用了torndb模块来操作mysql
torndb 内置的方法:execute 执行语句不需要返回值的操作。execute_lastrowid 执行后获得表id,一般用于插入后获取返回值。executemany 可以执行批量插入。返回值为第一行的id。executemany_rowcount 批量执行。返回值为总行数。get 执行后获取一行数据,返回dict。iter 执行查询后,返回迭代的字段和数据。query 执行后获取多行数据,返回是List。
insert 单条插入,返回第一行idinsertmany 批量插入,返回第一行idupdate 单条更新,返回执行行数updatemany 批量更新,返回总行数
close 关闭max_idle_time 最大连接时间reconnect 关闭后再连接